﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml.Linq;
using AjaxPro;
public partial class js_Default : System.Web.UI.Page
{
    /// <summary>
    /// 
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    Linq查询DataContext DB = new Linq查询DataContext();//和到数据源
    /// <summary>
    /// 总页码
    /// </summary>
    public int ss = 0;
    /// <summary>
    /// PageSize
    /// </summary>
    int pagesize = 1;
    protected void Page_Load(object sender, EventArgs e)
    {

       //Response.Write( PageData(2));
       Utility.RegisterTypeForAjax(typeof(js_Default));
       var tablepp = from x数据表 in DB.books
                      select x数据表;//数据表
       ss = tablepp.ToArray().Length / pagesize;
    }

    [AjaxMethod]
    /// <summary>
    /// 滑动条分页
    /// </summary>
    /// <param name="currentpage">页数</param>
    /// <returns></returns>
    public string PageData(int currentpage)
    {
        
        int rows =pagesize*currentpage;//当前的列
        
        string uuu = "<table border=1>";
        var tablepp = from x数据表 in DB.books
                      select x数据表;//数据表
        if (tablepp.ToArray().Length > rows)
        {
            foreach (var TRows in tablepp.Skip(tablepp.ToArray().Length - rows).Take(pagesize))
            {
                uuu += "<tr>";
                uuu += "<td>" + TRows.bookid + "</td>";
                uuu += "<td>" + TRows.bookname + "</td>";
                uuu += "<td>" + TRows.adddate + "</td>";
                uuu += "<td>" + TRows.bookchuban + "</td>";
                uuu += "</tr>";
            }
        }
        uuu += "</table>";
        return uuu;
    }



}
